$(function(){
	var developerId = getQueryString("id");
	loading();
	ajaxselectProductions(1, developerId);
});


/**
 * 加载 内容商的产品（应用）
 * @param page	当前页码
 * @param developerId	内容商id
 */
function ajaxselectProductions(page, developerId) {
	var url="/Lvscore_User_M/adScore/ajaxselectProductions";
	$.post(
		url,
		{
			'page' : page,
			'developerId' : developerId
		},
		function(data){
			$("#dev_img").html('<img src="' + getDevLogo(data.userTowardBalanceDto.developer.logo) + '" alt="">');
			$("#devName").text(data.userTowardBalanceDto.developer.company_name);
			$("#donkeyNum").text(data.userTowardBalanceDto.developer.donkey_num);
			$("#devAddr").text(data.userTowardBalanceDto.developer.company_address);

			/*map：
				sumpage：总页数
				nowpage：页码
				userTowardBalanceDto：
					developer：DeveloperBean
					applicationList：List<ApplicationNewBean>*/
			$("#info").empty();
			if (!isNotEmpty(data.userTowardBalanceDto.applicationList)) {
				$("#info").append('<p class="noResult"><img src="/Lvscore_User_M/userWeb/static/images/dissearch.png" alt="">该内容商无上架应用</p>');
			}
			$.each(data.userTowardBalanceDto.applicationList, function(i, e) {
				$("#info").append(
					"<div class='application inline-block'>" +
						"<p class='appTag'>" + "应用" + "</p>" + //e.classify
                        "<img src='" + getDevLogo(e.logourl) + "' alt='' style='width:350px;height:200px;'>" +
                        "<div class='botmask'>" +
	                        "<p class='appName'>" + e.name + "</p>" +
	                        "<p class='appIfo'>" + e.longdesc + "</p>" +
                            "<a href='/Lvscore_User_M/userWeb/views/ADadmin/accounterMoney/productShop.html?id=" + e.id + "' class='border_radius'>购买</a>" +
                        "</div>" +
                    "</div>"
				);
			});

			$(".loadingBox").hide();
		},
		"json"
	);
}

function getDevLogo(logo) {
	if (logo == null || logo == 'null' || logo == '')
		return '/Lvscore_User_M/userWeb/static/images/product_03.png';
	else
		return logo;
}